package com.gblw.rjkf.pj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gblw.rjkf.pj.entity.TStorage;
import com.gblw.rjkf.pj.mapper.TStorageMapper;
import com.gblw.rjkf.pj.service.TStorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * TStorageServiceImpl(TStorage)
 *
 * @author wj
 * @since 2024-09-24 19:45:33
 */
@Slf4j
@Service
public class TStorageServiceImpl extends ServiceImpl<TStorageMapper, TStorage> implements TStorageService {
    @Override
    public void decreaseStorage(Long prodouctId, Integer count) {
        log.info("----------->storage-service---中扣减库存开始");
        TStorage storage = new TStorage();
        storage.setResidue(count);
        storage.setUsed(count);
        QueryWrapper<TStorage> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("prodouct_id", prodouctId);
        baseMapper.update(storage,queryWrapper);
    }
}
